<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style/global.css" />
<link rel="stylesheet" type="text/css" href="style/admin.css" />
<link rel="stylesheet" type="text/css" href="style/tip.css" />
<script src="js/xheditor/jquery/jquery-1.4.4.min.js"></script>
<script src="js/artDialog/artDialog.js"></script>
<script src="js/artDialog/plugins/iframeTools.js"></script>
<title>回访规则设置</title>
</head>
<body>
<div id="wrap">
<div id="public_head"></div>
<div class="m_revise" id="revise">
<form action='' method='post' id="form"><input type='hidden' name='key'
	value='<?php echo $keys;?>'> <input type='hidden' name='pids'
	value='<?php echo $ruleInfo['OLD_QUES_IDS'];?>'>
<table class="tableForm" width="0" border="0">
	<tr>
		<th height="45" width="70">规则名称</th>
		<td colspan="2"><input class="qf_text" name="t_name" type="text"
			value="<?php echo $ruleInfo['TITLE']?$ruleInfo['TITLE']:'';?>" /></td>
	</tr>
	<tr>
		<th height="45" width="70">规则编号</th>
		<td colspan="2"><input class="qf_text" name="t_code" type="text" <?php if(isset($id))echo 'disabled';?> value="<?php echo $ruleInfo['R_ID']?$ruleInfo['R_ID']:'';?>" /></td>
	</tr>
	<tr>
		<th height="45" width="70">规则地址</th>
		<td colspan="2"><input class="qf_text" name="t_url" type="text" <?php if(isset($id))echo 'disabled';?> value="<?php echo $ruleInfo['URL']?$ruleInfo['URL']:'';?>" /></td>
	</tr>
	<tr>
		<th height="45">规则对象</th>
		<td colspan="2">
		<table>
			<tr>
				<td><select class="select" id="select_level" name="t_level"
					<?php if(isset($id))echo 'disabled';?>>
					<option value='1'
						<?php echo $ruleInfo['RLEVEL']==1?'selected':'';?>>医院</option>
					<option value='2'
						<?php echo $ruleInfo['RLEVEL']==2?'selected':'';?>>科室</option>
					<option value='3'
						<?php echo $ruleInfo['RLEVEL']==3?'selected':'';?>>医生</option>
				</select></td>
				<td><span style="display: none;" id='select_2'>科室 <select
					class="select" name="t_dep" <?php if(isset($id))echo 'disabled';?>>
              		<?php 
              			if(is_array($dep) && count($dep)>0){
              				foreach ($dep as $v){
              		?>
              			<option value="<?php echo $v['DID']?>"
						<?php if($v['DID']==$ruleInfo['DEP_NO'])echo 'selected';?>><?php echo $v['DN']?></option>
              		<?php 
              				}
              			}else{
              		?>
              			<option value='0'>还没有添加科室资料</option>
              		<?php }?>
              		</select> </span></td>
				<td><span style="display: none;" id='select_3'>医生 <select
					class="select" name="t_doc" <?php if(isset($id))echo 'disabled';?>>
					<?php 
              			if(is_array($doc) && count($doc)>0){
              				foreach ($doc as $v){
              		?>
              			<option value="<?php echo $v['DID']?>"
						<?php if($v['DID']==$ruleInfo['DOC_NO'])echo 'selected';?>><?php echo $v['DN']?></option>
              		<?php 
              				}
              			}else{
              		?>
              			<option value='0'>还没有添加医生资料</option>
              		<?php }?>
              		</select> </span></td>
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<th height="45">指定问卷</th>
		<td width="220" id="show_quesnr">
		<?php if(isset($quesnrinfo['TITLE'])){ ?>
			<a target='_blank' href="/index.php?c=quesnr&a=showquest&look=ny&id=<?php echo $quesnrinfo['QID']?>"><?php echo $quesnrinfo ['TITLE']?></a>
		<?php }else{
		?>
			<span style="color:red;cursor:pointer;" onclick="T.setCookie('value',T.serialize('form'));if(T.setCookie('back_visitrule_edit','<?php echo $_SERVER['REQUEST_URI']?>',3600)){document.location.href='/index.php?c=visitrule&a=sys'}">请选择问卷</span>
		<?php			
			}
		?>
		</td>
		<td>
			<input type='hidden' id="quesnr_id" name="t_quesnr" value="<?php echo $quesnrinfo['QID']; ?>" />
			<input class="btn_gray" name="" type="button" value="选择问卷" onclick="T.setCookie('value',T.serialize('form'));if(T.setCookie('back_visitrule_edit','<?php echo $_SERVER['REQUEST_URI']?>',3600)){document.location.href='/index.php?c=visitrule&a=sys'}" /></td>
	</tr>
	<tr>
		<th height="45">备注</th>
		<td colspan="2"><textarea rows="5" cols="50" name="t_info"><?php
		echo $ruleInfo ['DESCRPITION'] ? $ruleInfo ['DESCRPITION'] : ''?></textarea></td>
	</tr>
	<tr>
		<th height="45"></th>
		<td colspan="2"><input class="btn_save" name="sub_add" type="submit"
			value="" /> <input class="btn_gray" name="" type="button"
			onclick="location.href='/index.php?c=visitrule&a=index'" value="返 回" /></td>
	</tr>
</table></form>
</div>
</div>
</script>
</body>
</html>
<script src="/js/boot.js" type="text/javascript"></script>
<script src="/js/tip.js" type="text/javascript"></script>
<script src="/js/add_public_head.js" type="text/javascript"></script>
<script>
$('#select_level').change(function (){
	$('#select_2').hide();
	$('#select_3').hide();
	$('#select_'+$(this).val()).show();
})
<?php
	if($_REQUEST['a'] == 'add'){
?>
		setTimeout(function(){
			if(T && T.getCookie('value')){
				var a = T.getCookie('value')
				var b = T.deserialize(a)
				for(keyss in b){
					if($('[name="'+keyss+'"]').attr('id') != 'quesnr_id'){
						$('[name="'+keyss+'"]').val(decodeURI(b[keyss]))
					}
				}
			}
			outshow();
			T.delCookie('value')
		},1000)
<?php
	}
?>
function outshow(){
	switch($('#select_level').val()){
		case '2':$('#select_2').show();$('#select_3').hide();break;
		case '3':$('#select_3').show();$('#select_2').hide();break;
		default:$('#select_2').hide();$('#select_3').hide();break;
	}
}
outshow();
</script>